home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcl / src-16f.lha / compiler / sparc / parms.lisp < prev    next >
Encoding:
Text File  |  1992-12-17  |  6.6 KB  |  227 lines

  1. ;;; -*- Package: SPARC -*-
  2. ;;;
  3. ;;; **********************************************************************
  4. ;;; This code was written as part of the CMU Common Lisp project at
  5. ;;; Carnegie Mellon University, and has been placed in the public domain.
  6. ;;; If you want to use this code or any part of CMU Common Lisp, please contact
  7. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
  8. ;;;
  9. (ext:file-comment
  10.   "$Header: parms.lisp,v 1.13.2.1 92/12/17 13:25:47 ram Exp $")
  11. ;;;
  12. ;;; **********************************************************************
  13. ;;;
  14. ;;;    This file contains some parameterizations of various VM
  15. ;;; attributes for the SPARC.  This file is separate from other stuff so 
  16. ;;; that it can be compiled and loaded earlier. 
  17. ;;;
  18. ;;; Written by Rob MacLachlan
  19. ;;;
  20. ;;; Converted to MIPS by William Lott.
  21. ;;;
  22.  
  23. (in-package "SPARC")
  24. (use-package "C")
  25.  
  26.  
  27. ;;;; Compiler constants.
  28.  
  29. (eval-when (compile eval load)
  30.  
  31. (setf (backend-name *target-backend*) "SPARC")
  32. (setf (backend-version *target-backend*) "SPARCstation/Sun 4")
  33. (setf (backend-fasl-file-type *target-backend*) "sparcf")
  34. (setf (backend-fasl-file-implementation *target-backend*)
  35.       sparc-fasl-file-implementation)
  36. (setf (backend-fasl-file-version *target-backend*) 2)
  37. (setf (backend-register-save-penalty *target-backend*) 3)
  38. (setf (backend-byte-order *target-backend*) :big-endian)
  39.  
  40. ); eval-when
  41.  
  42.  
  43. ;;;; Machine Architecture parameters:
  44.  
  45. (export '(word-bits byte-bits word-shift word-bytes float-sign-shift
  46.  
  47.       single-float-bias single-float-exponent-byte
  48.       single-float-significand-byte single-float-normal-exponent-min
  49.       single-float-normal-exponent-max single-float-hidden-bit
  50.       single-float-trapping-nan-bit single-float-digits
  51.  
  52.       double-float-bias double-float-exponent-byte
  53.       double-float-significand-byte double-float-normal-exponent-min
  54.       double-float-normal-exponent-max double-float-hidden-bit
  55.       double-float-trapping-nan-bit double-float-digits
  56.  
  57.       float-underflow-trap-bit float-overflow-trap-bit
  58.       float-imprecise-trap-bit float-invalid-trap-bit
  59.       float-divide-by-zero-trap-bit))
  60.  
  61.       
  62.  
  63. (eval-when (compile load eval)
  64.  
  65. (defconstant word-bits 32
  66.   "Number of bits per word where a word holds one lisp descriptor.")
  67.  
  68. (defconstant byte-bits 8
  69.   "Number of bits per byte where a byte is the smallest addressable object.")
  70.  
  71. (defconstant word-shift (1- (integer-length (/ word-bits byte-bits)))
  72.   "Number of bits to shift between word addresses and byte addresses.")
  73.  
  74. (defconstant word-bytes (/ word-bits byte-bits)
  75.   "Number of bytes in a word.")
  76.  
  77.  
  78. (defconstant float-sign-shift 31)
  79.  
  80. (defconstant single-float-bias 126)
  81. (defconstant single-float-exponent-byte (byte 8 23))
  82. (defconstant single-float-significand-byte (byte 23 0))
  83. (defconstant single-float-normal-exponent-min 1)
  84. (defconstant single-float-normal-exponent-max 254)
  85. (defconstant single-float-hidden-bit (ash 1 23))
  86. (defconstant single-float-trapping-nan-bit (ash 1 22))
  87.  
  88. (defconstant double-float-bias 1022)
  89. (defconstant double-float-exponent-byte (byte 11 20))
  90. (defconstant double-float-significand-byte (byte 20 0))
  91. (defconstant double-float-normal-exponent-min 1)
  92. (defconstant double-float-normal-exponent-max #x7FE)
  93. (defconstant double-float-hidden-bit (ash 1 20))
  94. (defconstant double-float-trapping-nan-bit (ash 1 19))
  95.  
  96. (defconstant single-float-digits
  97.   (+ (byte-size single-float-significand-byte) 1))
  98.  
  99. (defconstant double-float-digits
  100.   (+ (byte-size double-float-significand-byte) word-bits 1))
  101.  
  102.  
  103. (defconstant float-inexact-trap-bit (ash 1 0))
  104. (defconstant float-divide-by-zero-trap-bit (ash 1 1))
  105. (defconstant float-underflow-trap-bit (ash 1 2))
  106. (defconstant float-overflow-trap-bit (ash 1 3))
  107. (defconstant float-invalid-trap-bit (ash 1 4))
  108.  
  109. (defconstant float-round-to-nearest 0)
  110. (defconstant float-round-to-zero 1)
  111. (defconstant float-round-to-positive 2)
  112. (defconstant float-round-to-negative 3)
  113.  
  114. (defconstant float-rounding-mode (byte 2 30))      ; RD 
  115. (defconstant float-sticky-bits (byte 5 5))      ; aexc
  116. (defconstant float-traps-byte (byte 5 23))      ; TEM
  117. (defconstant float-exceptions-byte (byte 5 0))      ; cexc
  118.  
  119. ;;; According to the SPARC doc (as opposed to FPU doc), the fast mode bit (EFM)
  120. ;;; is "reserved", and should always be zero.
  121. (defconstant float-fast-bit 0)
  122.  
  123. ); eval-when
  124.  
  125.  
  126. ;;;; Description of the target address space.
  127.  
  128. (export '(target-read-only-space-start
  129.       target-static-space-start
  130.       target-dynamic-space-start))
  131.  
  132. ;;; Where to put the different spaces.
  133. ;;; 
  134. (defparameter target-read-only-space-start #x00200000)
  135. (defparameter target-static-space-start    #x0c000000)
  136. (defparameter target-dynamic-space-start   #x10000000)
  137.  
  138.  
  139.  
  140. ;;;; Other random constants.
  141.  
  142. (export '(halt-trap pending-interrupt-trap error-trap cerror-trap
  143.       breakpoint-trap function-end-breakpoint-trap
  144.       object-not-list-trap object-not-structure-trap
  145.       trace-table-normal trace-table-call-site
  146.       trace-table-function-prologue trace-table-function-epilogue))
  147.  
  148. (defenum (:suffix -trap :start 8)
  149.   halt
  150.   pending-interrupt
  151.   error
  152.   cerror
  153.   breakpoint
  154.   function-end-breakpoint)
  155.  
  156. (defenum (:prefix object-not- :suffix -trap :start 16)
  157.   list
  158.   structure)
  159.  
  160. (defenum (:prefix trace-table-)
  161.   normal
  162.   call-site
  163.   function-prologue
  164.   function-epilogue)
  165.  
  166.  
  167.  
  168. ;;;; Static symbols.
  169.  
  170. (export '(static-symbols exported-static-symbols))
  171.  
  172. ;;; These symbols are loaded into static space directly after NIL so
  173. ;;; that the system can compute their address by adding a constant
  174. ;;; amount to NIL.
  175. ;;;
  176. ;;; The exported static symbols are a subset of the static symbols that get
  177. ;;; exported to the C header file.
  178. ;;;
  179. (defparameter static-symbols
  180.   '(t
  181.  
  182.     ;; The C startup code must fill these in.
  183.     lisp::lisp-environment-list
  184.     lisp::lisp-command-line-list
  185.  
  186.     ;; Functions that the C code needs to call
  187.     lisp::%initial-function
  188.     lisp::maybe-gc
  189.     kernel::internal-error
  190.     di::handle-breakpoint
  191.  
  192.     ;; Free Pointers.
  193.     lisp::*read-only-space-free-pointer*
  194.     lisp::*static-space-free-pointer*
  195.     lisp::*initial-dynamic-space-free-pointer*
  196.  
  197.     ;; Things needed for non-local-exit.
  198.     lisp::*current-catch-block*
  199.     lisp::*current-unwind-protect-block*
  200.     *eval-stack-top*
  201.  
  202.     ;; Interrupt Handling
  203.     lisp::*free-interrupt-context-index*
  204.     lisp::*pseudo-atomic-atomic*
  205.     lisp::*pseudo-atomic-interrupted*
  206.     unix::*interrupts-enabled*
  207.     unix::*interrupt-pending*
  208.  
  209.     ;; Static functions.
  210.     length
  211.     two-arg-+ two-arg-- two-arg-* two-arg-/ two-arg-< two-arg-> two-arg-=
  212.     two-arg-<= two-arg->= two-arg-/= eql %negate
  213.     two-arg-and two-arg-ior two-arg-xor
  214.     two-arg-gcd two-arg-lcm
  215.     ))
  216.  
  217. (defparameter exported-static-symbols
  218.   (subseq static-symbols 0 (position 'length static-symbols)))
  219.  
  220.  
  221.  
  222. ;;;; Assembler parameters:
  223.  
  224. ;;; The number of bits per element in the assemblers code vector.
  225. ;;;
  226. (defparameter *assembly-unit-length* 8)
  227.